var t = require("../../../utils/themeSkin/skinBehavior"), a = getApp();

Page({
    data: {
        current_index: 0,
        list: [],
        current_page: 1,
        last_page: 1
    },
    behaviors: [ t ],
    onLoad: function(t) {
        this.getData({
            page: 1,
            search: {
                status: 3
            }
        });
    },
    change: function(t) {
        var a = t.currentTarget.dataset.index;
        this.setData({
            current_index: a
        });
        var e = 0 == a ? 3 : 1 == a ? 5 : 4;
        this.getData({
            search: {
                status: e
            }
        });
    },
    getData: function(t) {
        var e = this;
        a._postNetWork({
            url: a.getNetAddresss("plugin.exchange-code.api.record.list"),
            data: t,
            success: function(t) {
                var s = t.data, n = s.result, i = s.data, r = i.data, o = i.current_page, c = i.last_page, u = s.msg;
                if (n) if (e.setData({
                    current_page: o,
                    last_page: c
                }), 1 == o) e.setData({
                    list: r || []
                }); else {
                    var g = e.data.list.concat(r);
                    e.setData({
                        list: g
                    });
                } else a.tips(u);
            }
        });
    },
    getMoreData: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var t = {
                page: this.data.current_page + 1,
                search: {
                    status: this.data.active + 3
                }
            };
            this.getData(t);
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getMoreData();
    },
    onShareAppMessage: function() {}
});